package com.itheima.a01myfunction;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class FunctionDemo7 {
    public static void main(String[] args) {
        /**
         * 需求:
         *  集合中存储一些字符串的数据，
         *  比如:张三，23
         *  收集到student类型的数组当中
         */
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "张无忌-18", "周芷若-19", "赵敏-21", "张强-23", "张三丰-27");

        Student[] students = list.stream().map(Student::new).toArray(Student[]::new);
        System.out.println(Arrays.toString(students));
    }
}
